package time.after.time.entity.pro;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnore;

import time.after.time.entity.IdEntity;
import time.after.time.sys.utils.Mapper;

/**
 * 
 * @author HuMing create in 2013-3-28
 */
@Entity
@Table(name = "city")
public class City extends IdEntity {

	private String areaCode;
	private String name;
	private String zipCode;
	private Integer pId;
	private String grade;
	
	private boolean nocheck;//ztree  父节点不显示checkbox

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getpId() {
		return pId;
	}

	public void setpId(Integer pId) {
		this.pId = pId;
	}
	
	@JsonIgnore
	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}
	@Transient
	public boolean getNocheck() {
		return pId==null;
	}
	
	@JsonIgnore
	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}
	@JsonIgnore
	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public void setNocheck(boolean nocheck) {
		this.nocheck = nocheck;
	}
	
	public static void main(String[] args) {
		City city=new City();
		city.setAreaCode("aaa");
		city.setGrade("2");
		city.setId(1l);
		city.setName("江西");
		city.setNocheck(true);
		city.setpId(111);
		city.setZipCode("111");
		
		System.out.println(Mapper.writeValueAsString(city, ""));
		
	}
	
}
